package com.java.Filter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(value = {"/filter1/servlet", "/filter1/filter2/servlet"})
public class Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("你好！"); // 中文乱码在过滤器中被解决
    }

    /**
     * /filter1/servlet输出结果：过滤器1过滤前 过滤器1过滤后
     * /filter1/filter2/servlet输出结果：过滤器1过滤前 过滤器2过滤前 过滤器2过滤后 过滤器1过滤后
     */
}
